package cn.samler.diandi.api.model.io.request.post;

import cn.samler.diandi.api.annotation.IsRole;
import cn.samler.diandi.api.model.io.request.pub.Point;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.Date;
import java.util.List;

@Data
public class Publish {
    @NotBlank(message = "标题不能为空")
    private String title;

    @IsRole
    private String role;

    @DecimalMin(value = "1", message = "报酬不能为空")
    private Double reward;

    @NotBlank(message = "结算单位不能为空")
    private String rewardUnit;

    @NotBlank(message = "地址不能为空")
    private String address;

    @Valid
    @NotNull(message = "position must be not null")
    private Point position;

    @NotNull(message = "images must be not null")
    private List<String> images;

    @NotBlank(message = "内容不能为空")
    private String content;

    @NotNull(message = "tag must be not null")
    private List<String> tag;

    @Future(message = "截止时间只能是未来的某一个时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date expireDate;
}
